/**
 * Created by 白雨浓 on 2018/12/6 17:38.
 *
 * 验证工具
 */
export default {
  install(Vue) {
    Vue.prototype.$valid = (self, form = 'form') => {
      return new Promise((resolve, reject) => {
        self.$refs[form].validate((valid) => {
          if (valid) {
            resolve(valid);
          } else {
            reject();
          }
        });
      });
    }
  }
}